<?php

declare(strict_types=1);

namespace App\CustHub\Constants;

use App\Common\Constants\AbstractBaseConstants;
use Hyperf\Constants\Annotation\Constants;
use Hyperf\Constants\Annotation\Message;

/**
 * 联盟账号类型
 */
#[Constants]
class AffiliateAccountTypeConstants extends AbstractBaseConstants
{
    #[Message('淘宝')]
    const TAOBAO = 1;

    #[Message('京东')]
    const JD = 2;

    #[Message('拼多多')]
    const PDD = 3;

    #[Message('唯品会')]
    const WPH = 4;

    #[Message('抖音')]
    const DY = 5;

    #[Message('饿了么')]
    const ELE = 6;

    #[Message('美团')]
    const MT = 7;

    public static function getTaps(): array
    {
        return [
            self::TAOBAO    => 'taobao',
            self::JD        => 'jd',
            self::PDD       => 'pdd',
            self::WPH       => 'wph',
            self::DY        => 'dy',
            self::ELE       => 'ele',
            self::MT       => 'mt',
        ];
    }

    public static function getCode(int $type): string
    {
        return self::getTaps()[$type] ?? '';
    }
}